package com.stylefeng.guns.Schedule;

import com.stylefeng.guns.modular.netcar.service.IOrderInfService;
import com.stylefeng.guns.modular.netcar.service.ITaskInfService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Async
public class ScheduledService {
    @Autowired
    private IOrderInfService orderInfService;

    @Autowired
    private ITaskInfService taskInfService;


    @Scheduled(cron = "0/30 * * * * ?")
    public void scheduledAutoTask(){
        try {
            taskInfService.autoPackegeTask();
        }catch(Exception e){

        }
    }
    //下单后30分钟未付款 清理占座的票数 并且
    @Scheduled(cron = "0/30 * * * * ?" )
    public void scheduledClearTicket() {
        try {
            orderInfService.scheduleClearTicket();
        }catch(Exception e){

        }
    }
}
